package cn.fengshenghospital.controller;

import cn.fengshenghospital.entity.Article;
import cn.fengshenghospital.entity.Friendship;
import cn.fengshenghospital.service.FriendshipService;
import cn.fengshenghospital.vo.JsonBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/friendship")
public class FriendshipController {

    @Autowired
    private FriendshipService friendshipService;

    @RequestMapping("/queryFriendshipAll")
    public JsonBean queryFriendshipAll(){
        JsonBean jsonBean=new JsonBean("queryFriendshipAll");
        try {
            List<Friendship> friendshipList=friendshipService.getFriendList();
            jsonBean.setData(friendshipList);
            jsonBean.setStatus(200);
        } catch (Exception e) {
            e.printStackTrace();
            jsonBean.setData(-1);
        }
        return jsonBean;
    }
}
